import java.util.ArrayList;
import java.util.List;

public class Solution401 {

    int[] time=new int[]{-1,8,4,2,1,32,16,8,4,2,1};

    public List<String> readBinaryWatch(int turnedOn) {
        List<String> ans=new ArrayList<>();
        int[] rec=new int[turnedOn];
        dfs(0,rec,1,ans);
        return ans;
    }

    void dfs(int k,int[] rec,int last,List<String> ans){
        if (k==rec.length){
            int hour=0,minute=0;
            for (int i=0;i<k;i++){
                if (rec[i]<=4){
                    hour=hour+time[rec[i]];
                }else{
                    minute=minute+time[rec[i]];
                }
            }
            if (hour>11 || minute>59){
                return;
            }
            StringBuilder stringBuilder=new StringBuilder();
            stringBuilder.append(hour).append(':');
            if (minute<10){
                stringBuilder.append(0);
            }
            stringBuilder.append(minute);
            ans.add(stringBuilder.toString());
            return;
        }
        for (int i=last;i<=10;i++){
            rec[k]=i;
            dfs(k+1,rec,i+1,ans);
        }
    }

    public static void main(String[] args) {
        System.out.println(new Solution401().readBinaryWatch(1));
    }
}
